<template>
  <div>
    <div class="top">
      <span class="iconfont icon-guanbi" @click="$router.go(-1)"></span>
      <span>账号与绑定</span>
      <span @click="save">保存</span>
    </div>

    <div class="personal_content_item">
      <p>手机号</p>
      <input type="text" v-model="phone" />
    </div>
    <div class="personal_content_item">
      <p>微信号</p>
      <input type="text" v-model="wechat" />
    </div>
    <div class="personal_content_item">
      <p>QQ号</p>
      <input type="text" v-model="qq" />
    </div>
    <div class="personal_content_item">
      <p>邮箱</p>
      <input type="text" v-model="mailbox" />
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      name: "中分背带裤",
      id: 35882,
      phone: 18211370484,
      autograph: "你干嘛？？？",
      wechat:"a1010507833",
      qq:390964050,
      mailbox:'390964050@qq.com'
    };
  },
  methods: {
    //信息保存
    save() {
      window.localStorage.name = this.name;
      window.localStorage.phone = this.phone;
      window.localStorage.autograph = this.autograph;
      window.localStorage.wechat = this.wechat;
      window.localStorage.qq = this.qq;
      window.localStorage.mailbox = this.mailbox;
      this.$toast("保存成功");
    },
  },
  created() {
    if (!window.localStorage.name) {
      window.localStorage.setItem("name", "中分背带裤");
      window.localStorage.setItem("phone", "18211370484");
      window.localStorage.setItem("autograph", "你干嘛？？？");
      window.localStorage.setItem("wechat", "a1010507833");
      window.localStorage.setItem("qq", "390964050");
      window.localStorage.setItem("mailbox", "390964050@qq.com");
    }
    this.name = window.localStorage.name;
    this.phone = window.localStorage.phone;
    this.autograph = window.localStorage.autograph;
    this.wechat = window.localStorage.wechat;
    this.qq = window.localStorage.qq;
    this.mailbox = window.localStorage.mailbox;
  },
};
</script>

<style lang="scss" scoped>
.top {
  padding: 15px;
  display: flex;
  align-items: center;
  span {
    &:nth-child(1) {
      font-weight: 700;
      font-size: 18px;
    }
    &:nth-child(2) {
      flex: 1;
      text-align: center;
      font-weight: 700;
      font-size: 18px;
    }
  }
}

.personal_content_item {
  display: flex;
  padding: 15px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f4f4f4;
  input {
    border: none;
    text-align: right;
    color: #333;
  }
}
</style>
